<?php

namespace App\Workerman;

use GatewayWorker\Lib\Gateway;
use Workerman\Lib\Timer;

class Events
{

    public static function onWorkerStart($businessWorker)
    {
    }

    public static function onConnect($client_id)
    {
        Timer::add(1, function($client_id){
            //下发数据
            $data = json_encode([
                'platform'       => 'email',
            ]);
            //下发
            Gateway::sendToClient($client_id,$data);
        }, array($client_id), true);
    }

    public static function onWebSocketConnect($client_id, $data)
    {
    }

    public static function onMessage($client_id, $message)
    {
    }

    public static function onClose($client_id)
    {
    }
}
